<%--
  Created by IntelliJ IDEA.
  User: 14811
  Date: 2022-4-15
  Time: 11:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/common/common.jsp"%>
<html>
<head>
    <title>Title</title>
    <style>
        .iframeClass{
            height: 800px !important;
        }
        .user{
            float: right;
            margin-right: 50px;
            font-size: larger;
            margin-top: 10px;
        }
    </style>
    <script>
        $(function(){
            $("#tree").treeview({
                data : getTree(),
                borderColor: "blue",
                checkedIcon: "glyphicon glyphicon-check",
                // showCheckbox: true,
                collapseIcon: "glyphicon glyphicon-resize-small",
                expandIcon: "glyphicon glyphicon-resize-full",
                onNodeSelected: function(event, data){//一个节点被选择时触发
                     //console.log(data);
                    if(data.url!==""){
                        $.addtabs.add({
                            id: data.id,
                            title: data.text,
                            url: "<%=path%>" + data.url
                        })
                    }
                }
            });
        })

        function getTree() {
            var data = [];
            $.ajax({
                url : "<%=path%>/menuController/getMenu",
                dataType : "json",
                type : "post",
                async : false,
                success : function(result){
                    console.log(result);
                    data = result;
                },
                error : function(e) {
                    console.log(e);
                    toastr.error("请联系管理员");
                }
            })
            return data;
        }
    </script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-3">
            <div id="tree"></div>
        </div>
        <div class="user">
            用户名:${user.username}
            <a href="${pageContext.request.contextPath}/loginController/logout" >退出</a>
        </div >
        <div class="col-lg-9">
            <!-- 标题 -->
            <ul class="nav nav-tabs"></ul>

            <!-- 内容 -->
            <div class="tab-content">

            </div>
        </div>

    </div>

</div>
</body>
</html>
